# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=spice
pkgver=0.15.2
pkgrel=1
pkgdesc="Implements the SPICE protocol"
url="http://www.spice-space.org/"
arch="all"
license="LGPL-2.0-or-later"
makedepends="
	cyrus-sasl-dev
	gdk-pixbuf-dev
	glib-dev
	gst-plugins-base-dev
	gstreamer-dev
	libjpeg-turbo-dev
	lz4-dev
	meson
	openssl-dev>3
	opus-dev
	orc-dev
	pixman-dev
	py3-parsing
	py3-six
	spice-protocol
	zlib-dev
	"
subpackages="$pkgname-dev"
source="https://www.spice-space.org/download/releases/spice-server/spice-$pkgver.tar.bz2
	failing-tests.patch
	"

# secfixes:
#   0.15.0-r0:
#     - CVE-2020-14355
#   0.14.3-r1:
#     - CVE-2021-20201
#   0.14.1-r4:
#     - CVE-2019-3813
#   0.14.1-r0:
#     - CVE-2018-10873
#   0.12.8-r4:
#     - CVE-2017-7506
#   0.12.8-r3:
#     - CVE-2016-9577
#     - CVE-2016-9578

build() {
	abuild-meson \
		-Db_lto=true \
		-Dgstreamer=1.0 \
		-Dlz4=true \
		-Dsasl=true \
		-Dopus=enabled \
		-Dsmartcard=disabled \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	provides="$pkgname-server=$pkgver-r$pkgrel"
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
c8f273b9e97ef38a03b331f7d32c5f0a09d540523fe626568c845152cbd22273a92b3a08bc13fa2e061b913ad16ceb7cbddf142655cd9cdcd8eb5f646fa6aa26  spice-0.15.2.tar.bz2
4fe7665ba7ef63d92570a870eb74f907e9d68f465e6607de7f16233c1d4cd209f390b3d51e2f9da1dd2365027e0402c042396d049d8e78e1eebdd3f5c56686d5  failing-tests.patch
"
